#@layout()
#define main()
<link href="#(base)/fslayui/plugins/formSelect/formSelects.css" rel="stylesheet"/>
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form">
        	<input type="hidden" name="id"  id="id">
            <div class="layui-form-item">
            	<div class="layui-inline">
	                <label class="layui-form-label">学号</label>
	                <div class="layui-input-inline">
	                    <input type="text"  id="number"  name="number" required="" lay-verType="tips" lay-verify="required" placeholder="请输入学号" autocomplete="off" class="layui-input"/>
	                </div>
                </div>
                 <div class="layui-inline">
				      <button onclick="getStudent()" type="button" class="layui-btn">查询</button>
			    </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input disabled type="text" name="name"  id="name" required="" lay-verType="tips" lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">课程</label>
                <div class="layui-input-block">
               		<select id="course_id" name="course_id" xm-select="course_id" xm-select-radio>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">平时成绩</label>
                <div class="layui-input-block">
                    <input type="text" name="pingshiresult" required="" lay-verType="tips" lay-verify="required|number" placeholder="请输入平时成绩" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">实验成绩</label>
                <div class="layui-input-block">
                    <input type="text" name="shiyanresult" required="" lay-verType="tips" lay-verify="required|number" placeholder="请输入实验成绩" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">期末成绩</label>
                <div class="layui-input-block">
                    <input type="text" name="qimoresult" required="" lay-verType="tips" lay-verify="required|number" placeholder="请输入期末成绩" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">总成绩</label>
                <div class="layui-input-block">
                    <input type="text" name="zongresult" required="" lay-verType="tips" lay-verify="required|number" placeholder="请输入总成绩" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <hr/>
            <div class="layui-form-item" style="text-align: center;">
                <button class="layui-btn" lay-submit="" lay-filter="save" url="#(base)/result/addStudentResult">新增</button>
                <button type="button" class="layui-btn layui-btn-primary" function="close">关闭</button>
            </div>
        </form>
    </div>
</div>
<script>
var base = '#(base)';
var $,form,formSelects;
layui.use(['jquery', 'form', 'formSelects'], function() {
	var $=layui.jquery,
	form = layui.form,
    formSelects = layui.formSelects;
	formSelects.render("course_id");
})
function getStudent(){
	var number = $('#number').val();
	$.ajax({
		type:"POST",
		url:"/student/getStudentNumber",
		dataType:"json",
		data:{
			number:number
			},
		success:function(data){
			$('#id').val(data.id)
			$('#name').val(data.name)
			layui.formSelects.config('course_id', {
                searchUrl: base+'/student/getStudentCourseNumber?studentid='+data.id
            });
		},
		error:function(jqXHR){
			console.log("发生错误："+jqXHR.status);
		}
	});
}


</script>
#end